package cn.ljy.uem.web.action.frontend.mobile.course;

import cn.ljy.authority.web.controller.backstage.BaseController;
import cn.ljy.common.model.result.ResponseData;
import cn.ljy.common.utils.page.Pagination;
import cn.ljy.uem.model.query.SchoolCourseResourceQuery;
import cn.ljy.uem.model.query.SchoolCourseSectionQuery;
import cn.ljy.uem.service.SchoolCourseResourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "移动端课程资源模块")
@RestController
@RequestMapping(value = "/api/mobile/schoolcourseresource")
public class SchoolCourseResourceMobileController extends BaseController {

    @Autowired
    private SchoolCourseResourceService schoolCourseResourceService;

    @ApiOperation(value = "课程资源")
    @GetMapping("/all")
//    @Override
    protected ResponseData query(SchoolCourseResourceQuery query) {
        return  ResponseData.success(schoolCourseResourceService.findAll(query));
    }

  @ApiOperation(value = "分页查询所有课程资源数据")
  @GetMapping("/query")
  public ResponseData getAllCourse(Integer page, Integer pageSize, SchoolCourseResourceQuery query){
      Pagination pagination = schoolCourseResourceService.findAll(page,pageSize,query);
      return ResponseData.success(pagination);
  }


    @GetMapping("/getResourceBySection/{SectionId}")
    @ApiOperation(value = "查找章节对应的课程资源")
    protected ResponseData getResourceBySection(@PathVariable String SectionId) {
        return ResponseData.success(schoolCourseResourceService.GetAllCourseResourceBySectionId(SectionId));
    }




}
